import {
	post,
	get,
} from '@/api/request.js'

const weixinloginApi = async () => {
	const url = '/v3/login/index'
	const code = uni.getStorageSync('code')
	const params = {
		code,
	}
	const res = await post(url, params)
	if (!res) return
	return res
}

const h5loginApi = async () => {
	const url = '/v3/login/wechatLogin'
	const code = uni.getStorageSync('code')
	const params = {
		code,
	}
	const res = await get(url, params)
	if (!res) return
	return res
}

// #ifdef H5
const loginApi = h5loginApi
// #endif

// #ifdef APP || MP-WEIXIN
const loginApi = weixinloginApi
// #endif

module.exports = {
	loginApi,
}